const {
  uniacid
} = require("../../host");

var a = require("../../@babel/runtime/helpers/interopRequireDefault"),
  e = a(require("../../utils/util")),
  t = a(require("../../utils/logs")),
  o = getApp();
Page({
  data: {
    language: {},
    goodsData: [],
    bannerData: [{
      thumb: ""
    }],
    adPlace: [],
    params: {},
    memuData: [],
    indicatorDots: !0,
    vertical: !1,
    autoplay: !0,
    interval: 4e3,
    duration: 300,
    designerItem: [],
    isDesigner: !1,
    pageinfo: {},
    designer: "",
    readyshow: !1,
    defaultdata: "",
    last_page: "",
    isLoadMore: !1,
    page: 1,
    footshow: !1,
    fullShow: !1,
    popShow: !1,
    advertisement: {},
    bottomShowBol: !1,
    bottomShowBolIndex: 0,
    isWatch: !0,
    everyTime: !1,
    showNewcomerAward: !1,
    new_member_prize: {},
    page_id: 0,
    components: [],
    advertising: {},
    full_screen: {},
    top_info: {},
    bottom_info: {},
    mailInfo: {},
    clientWidth: "375",
    btnFlag: !1,
    foot_type: "",
    current_page: 1,
    total_page: 0,
    decorate_isLoadMore: !0,
    lastIndex: "",
    showPage: !0,
    showShare: !1,
    shareOptions: [{
      name: "分享给好友",
      icon: "wechat",
      openType: "share"
    }],
    goodshare_info: {},
    charityFundInfo: {
      show: !1,
      poster: ""
    },
    showDropdownMenu: !1,
    lotteryShareId: "",
    teamNameShow: !1,
    member_team_title: "",
    pageScrollTopV: 0,
    activePopShow: 0,
    // BackgroundAudioManager: null
    audio: null, //音频
    day_niu_num: '', //可激活牛数量
    day_niu_wenzi: '', //激活牛文字
    day_num_video: '', //激活牛视频
    activeVideoPopShow: 0,
    xiaoNiuPopShow: false,
    daNiuPopShow: false,
    isCanLing: false, //是否可以领取牛证
  },
  lingNiuzheng() {
    // 释放牛证
    wx.showLoading({
      title: '领取中',
    })
    var e = this,
      t = o.getNetAddresss("HuanNiu.niuzheng");
    o._getNetWork({
      url: t,
      data: {
        uid: wx.getStorageSync('yz_uid')
      },
      success: function (a) {
        var t = a.data;
        console.log(t, 'hongbaoLing')
        if (t.result == 1) {
          wx.hideLoading();
          wx.showToast({
            title: '牛证数量已到账',
            icon: 'none'
          })
          e.setData({
            activeVideoPopShow: !1
          })
          wx.reLaunch({
            url: '/packageG/index/index',
          })
        } else {
          wx.hideLoading();
          wx.showToast({
            title: t.msg,
            icon: 'none'
          })
        }
      }
    });
  },
  onPlayVideo: function () {
    console.log('播放了')

  },
  // onPause: function(e){
  //   console.log('暂停了',e)
  // },
  ended: function () {
    console.log('播放完了')
    // wx.showToast({
    //   title: '牛证数量已到账',
    //   icon: 'none'
    // })
    this.setData({
      // activeVideoPopShow: !1
      isCanLing: true
    })
  },
  closePopVideo() {
    this.setData({
      activeVideoPopShow: !1
    })
  },
  onCloseVideo: function () {
    this.setData({
      activeVideoPopShow: !1
    })
  },
  closeHuanniuPopVideo: function () {
    this.setData({
      activeVideoPopShow: !1
    })
  },
  wxPayTest: function () {

    wx.requestPayment({
      timeStamp: "1700642276",
      nonceStr: "5rine8jclx5azf55q99km2wltev1id2o",
      package: "prepay_id=wx22163756389616d48a1cd2863563f50000",
      signType: "MD5",
      paySign: "6C8E745F4D77B4EDF3B34847E9AA3CF5",
      success: function (a) {
        console.log(a, '成功')
      },
      fail: function (a) {
        console.log(a, '失败');
      }
    })
  },
  componentGoodShares: function (a) {
    a.detail && this.setData({
      goodshare_info: a.detail,
      showShare: !0
    });
  },
  componentMenuOpen: function (a) {
    this.setData({
      showDropdownMenu: a.detail
    });
  },
  componentMenuClose: function (a) {
    this.setData({
      showDropdownMenu: a.detail
    });
  },
  onClose: function () {
    this.setData({
      goodshare_info: {},
      showShare: !1
    });
  },
  onSelect: function () {
    this.setData({
      showShare: !1
    });
  },
  onShareTimeline: function () {
    var a = wx.getStorageSync("yz_uid"),
      e = "";
    a && (e = a);
    for (var t = {
        title: wx.getStorageSync("pageinfo").desc,
        query: "mid=".concat(e)
      }, o = 0; o < this.data.components.length; o++) "U_lottery" == this.data.components[o].component_key && (t.path = "/packageG/index/index?mid=" + e + "&lt=1");
    return t;
  },
  onShareAppMessage: function (a) {
    var e = wx.getStorageSync("yz_uid"),
      t = "";
    if (e && (t = e), a && "button" == a.from && "shareTag" == a.target.dataset.tag && "1" == a.target.dataset.item) {
      var i = "/packageB/member/group/GroupDetail/GroupDetail?id=" + a.target.dataset.info.id + "&mid=" + t,
        n = a.target.dataset.title;
      return a.target.dataset.store && (i = "/packageB/member/group/GroupDetail/GroupDetail?id=" + a.target.dataset.info.id + "store=" + a.target.dataset.store + "&mid=" + t),
        1 == o.globalData.store_alone_temp && that.globalData.STORE_ID && (i = "".concat(i, "&store_alone_id=").concat(o.globalData.STORE_ID)), {
          path: i,
          title: n
        };
    }
    var s = {
      title: wx.getStorageSync("pageinfo").title,
      path: "/packageG/index/index?mid=" + t
    };
    "{}" != JSON.stringify(this.data.goodshare_info) && "button" == a.from && (s.title = this.data.goodshare_info.name,
      s.path = "/packageA/detail_v2/detail_v2?id=" + this.data.goodshare_info.id + "&mid=" + t,
      s.imageUrl = this.data.goodshare_info.img), this.data.goodshare_info = {};
    for (var r = 0; r < this.data.components.length; r++) "U_lottery" == this.data.components[r].component_key && (s.path = "/packageG/index/index?mid=" + t + "&lt=1");
    return s;
  },
  onLoad: function (a) {
    // this.data.BackgroundAudioManager = wx.getBackgroundAudioManager()
    if (a && a.is_charity_fund && 1 == a.is_charity_fund && this.getCharityFundPoster(a.order_id),
      wx.showShareMenu({
        withShareTicket: !1,
        menus: ["shareAppMessage", "shareTimeline"]
      }), 1 == wx.getStorageSync("address-status")) {
      var e = wx.getStorageSync("address-point");
      console.log(e, "有选择的地址");
    } else console.log("没有选择的地址就定位当前位置");
    if (a.scene) {
      var t = decodeURIComponent(a.scene);
      if (console.log(t, "21668"), t) {
        var i = [];
        i = t.split(",");
        for (var n = 0; n < i.length; n++) {
          var s;
          "mid" == (s = i[n].split("="))[0] && o._setMid(s[1]), "address_code" == s[0] && (o.data.address_code = s[1]);
        }
      }
    }
    try {
      var r = wx.getUpdateManager();
      r.onUpdateReady(function () {
        wx.showModal({
          title: "更新提示",
          content: "新版本已经准备好，是否重启应用？",
          success: function (a) {
            a.confirm && r.applyUpdate();
          }
        });
      });
    } catch (a) {
      console.error(a);
    }
    a.mid && o._setMid(a.mid), 1 == a.lt && this.setData({
      lotteryShareId: a.mid
    });
    var d = wx.getStorageSync("new_decorate"),
      l = wx.getStorageSync("home_onUnload"),
      g = wx.getStorageSync("yz_basic_info");
    1 == l && d ? this._getOldData(d) : this._getData(), this.setData({
      mailInfo: g.home ? g.home.mailInfo : {},
      clientWidth: wx.getSystemInfoSync().windowWidth
    });
    wx.getStorageSync('yz_uid') ? (this.getIsActive(), this.getIsJihuoXiaoniu(), this.getIsJihuoDaniu()) : ''
    wx.setStorageSync('isMoneyUnitNiu', false)

  },
  onReady: function () {
    var a = wx.getStorageSync("langIndex");
    this.setData({
      language: a.en
    });
    wx.setStorageSync('isIndex', true)
  },
  onHide: function () {
    this.setData({
      showNewcomerAward: !1
    });
    wx.setStorageSync('isIndex', false)
  },
  onUnload: function () {
    wx.setStorageSync("home_onUnload", 1);
  },
  onPullDownRefresh: function () {
    console.log("onPullDownRefresh", new Date()), wx.setStorageSync("popAdvertisement", !1),
      this._getData();
  },
  onPageScroll: e.default.throttle(function (a) {
    var e = a[0];
    this.setData({
      pageScrollTopV: e.scrollTop
    }), e.scrollTop > 75 ? this.data.btnFlag || this.setData({
      btnFlag: !0
    }) : this.data.btnFlag && this.setData({
      btnFlag: !1
    }), this.data.bottomShowBol && this.setData({
      bottomShowBol: !1
    });
  }, 50),

  handleTap: function () {
    // 在这里实现页面跳转  
    console.log('点击了金牛')
    var e = this,
      t = o.getNetAddresss("HuanNiu.tuijian_niu");
    o._getNetWork({
      url: t,
      data: {
        uid: wx.getStorageSync('yz_uid')
      },
      success: function (a) {
        var t = a.data;
        console.log(t, 'tuijian_niu')
        if (t.result == 1) {
          wx.showToast({
            title: t.msg,
          })
          e.setData({
            daNiuPopShow: false
          });
        }
      }
    });
  },
  handleTap1: function () {
    // 在这里实现页面跳转  
    console.log('点击了银牛')
    var e = this,
      t = o.getNetAddresss("HuanNiu.lingqu_xiaoniu");
    o._getNetWork({
      url: t,
      data: {
        uid: wx.getStorageSync('yz_uid')
      },
      success: function (a) {
        var t = a.data;
        console.log(t, 'lingqu_xiaoniu')
        if (t.result == 1) {
          wx.showToast({
            title: t.msg,
          })
          e.setData({
            xiaoNiuPopShow: false
          });
        }
      }
    });
  },
  getIsActive() {
    var e = this,
      t = o.getNetAddresss("HuanNiu.jihuo");
    o._getNetWork({
      url: t,
      data: {
        uid: wx.getStorageSync('yz_uid')
      },
      success: function (a) {
        var t = a.data;
        console.log(t, 'getIsActive')
        if (t.result == 1 && t.data == 0) {
          e.setData({
            activePopShow: !0
          });
          var tt = o.getNetAddresss("HuanNiu.day_niu_num");
          o._getNetWork({
            url: tt,
            data: {
              uid: wx.getStorageSync('yz_uid')
            },
            success: function (a) {
              var data = a.data;
              console.log(data, 'day_niu_num')
              if (data.result == 1) {
                e.setData({
                  day_niu_num: data.data.niu,
                  day_niu_wenzi: data.data.wenzi,
                  day_num_video: data.data.video
                });

              }
            }
          });
        }
      }
    });

  },
  getIsJihuoXiaoniu() {
    var e = this,
      t = o.getNetAddresss("HuanNiu.tuijian_xiaoniu");
    o._getNetWork({
      url: t,
      data: {
        uid: wx.getStorageSync('yz_uid')
      },
      success: function (a) {
        var t = a.data;
        console.log(t, 'getIsArrive')
        if (t.result == 1 && t.data == 1) {
          console.log('11111111')
          e.setData({
            xiaoNiuPopShow: true
          })
          // wx.showToast({
          //   title: '恭喜你，完成推广两人任务，奖励一头银牛',
          //   icon:'none',
          //   duration: 5000
          // })
        }
      }
    });

  },
  getIsJihuoDaniu() {
    var e = this,
      t = o.getNetAddresss("HuanNiu.is_tuijian_niu");
    o._getNetWork({
      url: t,
      data: {
        uid: wx.getStorageSync('yz_uid')
      },
      success: function (a) {
        var t = a.data;
        console.log(t, 'getIsJihuoDaniu')

        
        if (t.result == 1 && t.data == 1) {
          console.log('11111111')
          e.setData({
            daNiuPopShow: true
          })
          // wx.showToast({
          //   title: '恭喜你，完成推广两人任务，奖励一头银牛',
          //   icon:'none',
          //   duration: 5000
          // })
        }
      }
    });

  },
  // 查询门店是否有未处理订单
  checkShopFahuo() {
    var e = this,
      t = o.getNetAddresss("HuanNiu.mendian_chuli_order");

    o._getNetWork({
      url: t,
      data: {
        uid: wx.getStorageSync('yz_uid')
      },
      success: function (a) {
        var t = a.data;
        console.log(t, 'hongbaoLing')
        if (t.result == 1) {
          if(t.data == 1){
            e.hongbaoLing()
          }else if (t.data == 2) {
            wx.showModal({
              title: '发货',
              content: '有未发货订单，全部发货后才能领取红包',
              cancelText: '取消',
              confirmText: '去发货',
              complete: (res) => {
                if (res.cancel) {

                }

                if (res.confirm) {
                  wx.navigateTo({
                    url: '/packageA/member/myOrder_v2/myOrder_v2?status=2&orderType=store',
                  })
                }
              }
            })
          }
          // e.data.audio.play() // 播放
          // console.log(e.data.audio, 'e.data.audio')
          // e.setData({
          //   activePopShow: !1
          // });

          // wx.showToast({
          //   title: t.msg,
          //   icon: 'none'
          // })

        } else {
          wx.showToast({
            title: t.msg,
            icon: 'none'
          })
        }
      }
    });
  },
  hongbaoLing() {

    this.data.audio = wx.createInnerAudioContext({
      useWebAudioImplement: false // 是否使用 WebAudio 作为底层音频驱动，默认关闭。对于短音频、播放频繁的音频建议开启此选项，开启后将获得更优的性能表现。由于开启此选项后也会带来一定的内存增长，因此对于长音频建议关闭此选项
    })

    this.data.audio.src = 'https://shops.cg500.com/static/tishiyin.MP3'
    this.data.audio.play() // 播放
    console.log(this.data.audio, 'e.data.audio')
    this.setData({
      activePopShow: !1,
      activeVideoPopShow: !0
    })
    // var e = this,
    //   t = o.getNetAddresss("HuanNiu.niuzheng");

    // o._getNetWork({
    //   url: t,
    //   data: {
    //     uid: wx.getStorageSync('yz_uid')
    //   },
    //   success: function (a) {
    //     var t = a.data;
    //     console.log(t, 'hongbaoLing')
    //     if (t.result == 1) {
    //       e.data.audio.play() // 播放
    //       console.log(e.data.audio, 'e.data.audio')
    //       e.setData({
    //         activePopShow: !1
    //       });

    //       wx.showToast({
    //         title: t.msg,
    //         icon: 'none'
    //       })

    //     } else {
    //       wx.showToast({
    //         title: t.msg,
    //         icon: 'none'
    //       })
    //     }
    //   }
    // });
  },
  getCharityFundPoster: function (a) {
    var e = this,
      t = o.getNetAddresss("plugin.charity-fund.api.create_new_poster.createPoster");
    o._getNetWork({
      url: t,
      data: {
        order_id: a
      },
      success: function (a) {
        var t = a.data;
        1 == t.result && e.setData({
          "charityFundInfo.show": !0,
          "charityFundInfo.poster": t.data
        });
      }
    });
  },
  closeCharityFundPoster: function () {
    this.setData({
      "charityFundInfo.show": !1
    });
  },
  closeHuanniuPop: function () {
    console.log(this.data.activePopShow, 'activePopShow')
    this.setData({
      activePopShow: !1
    });
  },
  closeXiaoniuPop: function () {
    console.log(this.data.xiaoNiuPopShow, 'activePopShow')
    this.setData({
      xiaoNiuPopShow: !1
    });
  },
  closeDaniuPop: function () {
    console.log(this.data.xiaoNiuPopShow, 'activePopShow')
    this.setData({
      daNiuPopShow: !1
    });
  },
  onReachBottom: function () {
    console.log("页面触底 onReachBottom"), this.data.defaultdata && (this.data.isLoadMore ? this.getMoreData() : console.log("没有更多数据")),
      this.setData({
        bottomShowBol: !0
      }), console.log(this.data.bottomShowBol), this.data.decorate_isLoadMore && this.getMoreDecorate();
  },
  closeBtn: function () {
    this.setData({
      showNewcomerAward: !1
    });
    var a = wx.getStorageSync("popAdvertisement");
    this.data.advertising && this.data.advertising.id && !a && (wx.setStorageSync("popAdvertisement", !0),
      this.setData({
        popShow: !0
      }));
    var e = wx.getStorageSync("storage_newAward");
    console.log("关闭新人奖弹窗======"), e && (e = null, wx.setStorageSync("storage_newAward", e)),
      o._isTextEmpty(this.data.activityDatas.after_mini) || wx.redirectTo({
        url: this.data.activityDatas.after_mini
      });
  },
  initBalanceLang: function (a) {
    if (a && a.balance) try {
      wx.setStorageSync("balance", a.balance);
    } catch (a) {
      console.log(a);
    }
  },
  checkStoreAlone: function () {
    return 1 == o.globalData.store_alone_temp && (o.globalData.STORE_ID ? wx.reLaunch({
      url: "/packageG/independent_store/index/index?store_id=" + o.globalData.STORE_ID
    }) : wx.reLaunch({
      url: "/packageG/independent_store/access_tip/access_tip"
    }), !0);
  },
  _getOldData: function (a) {
    var e = this,
      i = this;
    if (!this.checkStoreAlone()) {
      wx.showLoading({
        title: "加载中"
      }), this.setData({
        showPage: !1
      }), i.setData({
        footshow: !0
      });
      var n = a.item,
        s = a.default;
      s && (i.setData({
        defaultdata: a.default,
        last_page: a.default.goods.last_page,
        isLoadMore: !1,
        page: 1
      }), i.setData({
        isLoadMore: i.data.last_page > 1
      }));
      var r = n.pageinfo ? n.pageinfo.params : {};
      if (i.setData({
          params: r,
          designer: a.designer ? a.designer : "",
          isWatch: 0 != r.allowauth
        }), !i.data.isWatch && n.page_info.member_level_url && n.page_info.member_level_url.link && n.page_info.member_level_url.link.indexOf("packageG/index/index") < 0 && wx.redirectTo({
          url: n.page_info.member_level_url.link
        }), console.log("会员是否可浏览装修页2", i.data.isWatch), "" != n.data && n.page_info && n.page_info.page_title ? (wx.setNavigationBarTitle({
          title: n.page_info.page_title ? n.page_info.page_title : i.data.mailInfo.name || ""
        }), wx.setStorageSync("pageinfo", {
          title: n.page_info.page_title ? n.page_info.page_title : i.data.mailInfo.name,
          desc: n.page_info.page_description
        })) : wx.setNavigationBarTitle({
          title: i.data.mailInfo.name || ""
        }), n.page_info && n.page_info.preview_color && wx.setNavigationBarColor({
          backgroundColor: n.page_info.preview_color,
          frontColor: 1 == n.page_info.font_color ? "#ffffff" : "#000000",
          animation: {
            duration: 400,
            timingFunc: "easeIn"
          }
        }), n.datas) {
        for (var d = 0; d < n.datas.length; d++) {
          if ("U_newBlindBox" == n.datas[d].component_key) {
            wx.redirectTo({
              url: "/packageF/new_blind_box/index"
            });
            break;
          }
          "U_goods" == n.datas[d].component_key && (n.datas[d].index = d), "U_location" == n.datas[d].component_key && (n.datas[d].home = !0),
            "U_signin" == n.datas[d].component_key && (n.datas[d].host = o.data.host), n.datas[d].designer = i.data.designer;
        }
        i.setData({
          isDesigner: !0,
          decorate_isLoadMore: !0,
          designerItem: n.datas,
          page_id: n.id,
          components: n.datas,
          foot_type: n.foot_type
        }), n.page && i.setData({
          total_page: n.page.total_page,
          current_page: n.page.current_page,
          bottomShowBolIndex: n.page.count - 1
        }), n.page_info && (i.setData({
          advertising: n.page_info.advertising_id || {},
          full_screen: n.page_info.full_screen_id || {}
        }), i.data.advertising.id && i.data.advertising.datas && (i.data.advertising.datas = JSON.parse(i.data.advertising.datas),
          i.setData({
            advertising: i.data.advertising
          }))), n.top && n.top.id && this.setData({
          top_info: JSON.parse(n.top.page_info)
        }), -1 == n.foot_type ? this.setData({
          bottom_info: {}
        }) : 1 == n.foot_type ? n.foot && n.foot.page_info ? this.setData({
          bottom_info: JSON.parse(n.foot.page_info)
        }) : this.setData({
          bottom_info: {}
        }) : 2 == n.foot_type && (n.foot instanceof Array ? this.setData({
          bottom_info: {}
        }) : this.setData({
          bottom_info: JSON.parse(n.foot.page_info)
        }));
        var l = wx.getStorageSync("fullAdvertisement");
        this.data.full_screen && this.data.full_screen.id && !l && 1 === this.data.full_screen.show_rule && (wx.setStorageSync("fullAdvertisement", !0),
          this.setData({
            fullShow: !0
          }), setTimeout(function () {
            e.countDown(e.data.full_screen.show_time);
          }, 2e3));
        var g = wx.getStorageSync("fullAdvertisement_expiration"),
          c = parseInt(Date.parse(new Date()) / 1e3);
        if (this.data.full_screen && this.data.full_screen.id && 2 === this.data.full_screen.show_rule && g < c) {
          var p = parseInt((new Date(new Date().toLocaleDateString()).getTime() + 864e5 - 1) / 1e3);
          wx.setStorageSync("fullAdvertisement_expiration", p), this.setData({
            fullShow: !0
          }), setTimeout(function () {
            e.countDown(e.data.full_screen.show_time);
          }, 2e3);
        }
      } else {
        i.setData({
          readyshow: !0
        });
        var _, f = s.category,
          m = f,
          h = Math.ceil(f.length / 10);
        wx.setStorageSync("pageinfo", {
          title: i.data.mailInfo.name,
          desc: i.data.mailInfo.name
        }), wx.setNavigationBarTitle({
          title: i.data.mailInfo.name || ""
        }), _ = f.length <= 5 ? "in1" : "in2";
        for (var u = [], w = 0; w < h; w++) {
          for (var v = [], D = 0; D < 10; D++) {
            null != f[D] && v.push(f[D]);
          }
          f = m = m.slice(10), u.push(v);
        }
        i.setData({
          bannerData: s.ads,
          goodsData: s.goods,
          memuData: u,
          footshow: !0,
          bottom_info: {},
          menuHeightClass: _
        });
      }
      i.setData({
        showPage: !0
      }), wx.hideLoading();
      try {
        var S = wx.getStorageSync("storage_newAward");
        if (S && S.prize) {
          var y = S,
            x = {},
            b = y.activity;
          x.type = y.activity.background_type, x.title = y.activity.title, x.awardlist = y.prize,
            0 == S.prize.length ? i.setData({
              showNewcomerAward: !1
            }) : (i.setData({
              new_member_prize: x,
              activityDatas: b
            }), setTimeout(function () {
              i.setData({
                showNewcomerAward: !0
              });
            }, 200));
        } else {
          var T = wx.getStorageSync("popAdvertisement");
          this.data.advertising && this.data.advertising.id && !T && 1 === this.data.advertising.show_rule && (wx.setStorageSync("popAdvertisement", !0),
            this.setData({
              popShow: !0
            }));
          var k = wx.getStorageSync("popAdvertisement_expiration"),
            A = parseInt(Date.parse(new Date()) / 1e3);
          if (this.data.advertising && this.data.advertising.id && 2 === this.data.advertising.show_rule && k < A) {
            var I = parseInt((new Date(new Date().toLocaleDateString()).getTime() + 864e5 - 1) / 1e3);
            wx.setStorageSync("popAdvertisement_expiration", I), this.setData({
              popShow: !0
            });
          }
        }
      } catch (a) {
        console.log("新人奖报错：：：", a);
      }
      try {
        var M = wx.getStorageSync("yz_basic_info");
        this.setData({
          teamNameShow: !(!M.globalParameter || !M.globalParameter.member_team),
          member_team_title: M.globalParameter && M.globalParameter.member_team ? M.globalParameter.member_team : ""
        }), this.address_codeMethod();
      } catch (a) {
        t.default.info("---------packageGindexindex.js 765------------", a);
      }
    }
  },
  _getData: function () {
    var a = this,
      e = this;
    if (!this.checkStoreAlone()) {
      var i = o.getNetAddresss("home-page.wxapp");
      wx.showLoading({
        title: "加载中"
      }), this.setData({
        showPage: !1
      }), o._getNetWork({
        url: i,
        success: function (i) {
          i.data && i.data.basic_info && (e.initBalanceLang(i.data.basic_info.balance), a.setData({
            mailInfo: i.data.basic_info.home ? i.data.basic_info.home.mailInfo : {}
          }));
          try {
            if (i.data.basic_info) a.setData({
              teamNameShow: !(!i.data.basic_info.globalParameter || !i.data.basic_info.globalParameter.member_team),
              member_team_title: i.data.basic_info.globalParameter && i.data.basic_info.globalParameter.member_team ? i.data.basic_info.globalParameter.member_team : ""
            }), a.address_codeMethod(i.data.basic_info);
            else {
              a.address_codeMethod();
              var n = wx.getStorageSync("yz_basic_info");
              a.setData({
                teamNameShow: !(!n.globalParameter || !n.globalParameter.member_team),
                member_team_title: n.globalParameter && n.globalParameter.member_team ? n.globalParameter.member_team : ""
              });
            }
          } catch (a) {
            console.log(a), t.default.info("---------packageGindexindex.js 777------------", a);
          }
          if (wx.stopPullDownRefresh({
              complete: function (a) {
                console.log("关闭下拉刷新", a, new Date());
              }
            }), e.setData({
              footshow: !0
            }), i.data.data.item && 1 != o.globalData.store_alone_temp) try {
            wx.setStorageSync("new_decorate", i.data.data);
          } catch (a) {
            console.log("数据过大真机会出现无法存储【#85269】", a);
          }
          var s = i.data.data.item,
            r = i.data.data.default;
          r && (e.setData({
            defaultdata: i.data.data.default,
            last_page: i.data.data.default.goods.last_page,
            isLoadMore: !1,
            page: 1
          }), e.setData({
            isLoadMore: e.data.last_page > 1
          }));
          var d = s.pageinfo ? s.pageinfo.params : {};
          if (e.setData({
              params: d,
              designer: i.data.data.designer ? i.data.data.designer : "",
              isWatch: 0 != d.allowauth
            }), !e.data.isWatch && s.page_info.member_level_url && s.page_info.member_level_url.link && s.page_info.member_level_url.link.indexOf("packageG/index/index") < 0 && wx.redirectTo({
              url: s.page_info.member_level_url.link
            }), console.log("会员是否可浏览装修页2", e.data.isWatch), "" != s.data && s.page_info && s.page_info.page_title ? (wx.setNavigationBarTitle({
              title: s.page_info.page_title ? s.page_info.page_title : e.data.mailInfo.name || ""
            }), wx.setStorageSync("pageinfo", {
              title: s.page_info.page_title ? s.page_info.page_title : e.data.mailInfo.name,
              desc: s.page_info.page_description
            })) : wx.setNavigationBarTitle({
              title: e.data.mailInfo.name || ""
            }), s.page_info && s.page_info.preview_color && wx.setNavigationBarColor({
              backgroundColor: s.page_info.preview_color,
              frontColor: 1 == s.page_info.font_color ? "#ffffff" : "#000000",
              animation: {
                duration: 400,
                timingFunc: "easeIn"
              }
            }), console.log(s.datas), s.datas) {
            for (var l = 0; l < s.datas.length; l++) {
              if ("U_newBlindBox" == s.datas[l].component_key) {
                wx.redirectTo({
                  url: "/packageF/new_blind_box/index"
                });
                break;
              }
              "U_goods" == s.datas[l].component_key && (s.datas[l].index = l), "U_location" == s.datas[l].component_key && (s.datas[l].home = !0),
                "U_signin" == s.datas[l].component_key && (s.datas[l].host = o.data.host), "U_couponStore" == s.datas[l].component_key && (s.datas[l].index = l),
                s.datas[l].designer = e.data.designer;
            }
            e.setData({
              isDesigner: !0,
              decorate_isLoadMore: !0,
              designerItem: s.datas,
              page_id: s.id,
              components: s.datas,
              foot_type: s.foot_type
            }), s.page && e.setData({
              total_page: s.page.total_page,
              current_page: s.page.current_page,
              bottomShowBolIndex: s.page.count - 1
            }), s.page_info && (e.setData({
              advertising: s.page_info.advertising_id || {},
              full_screen: s.page_info.full_screen_id || {}
            }), e.data.advertising.id && e.data.advertising.datas && (e.data.advertising.datas = JSON.parse(e.data.advertising.datas),
              e.setData({
                advertising: e.data.advertising
              }))), s.top && s.top.id && a.setData({
              top_info: JSON.parse(s.top.page_info)
            }), -1 == s.foot_type ? a.setData({
              bottom_info: {}
            }) : 1 == s.foot_type ? s.foot && s.foot.page_info ? a.setData({
              bottom_info: JSON.parse(s.foot.page_info)
            }) : a.setData({
              bottom_info: {}
            }) : 2 == s.foot_type && (s.foot instanceof Array ? a.setData({
              bottom_info: {}
            }) : a.setData({
              bottom_info: JSON.parse(s.foot.page_info)
            }));
            var g = wx.getStorageSync("fullAdvertisement");
            a.data.full_screen && a.data.full_screen.id && !g && 1 === a.data.full_screen.show_rule && (wx.setStorageSync("fullAdvertisement", !0),
              a.setData({
                fullShow: !0
              }), setTimeout(function () {
                a.countDown(a.data.full_screen.show_time);
              }, 2e3));
            var c = wx.getStorageSync("fullAdvertisement_expiration"),
              p = parseInt(Date.parse(new Date()) / 1e3);
            if (a.data.full_screen && a.data.full_screen.id && 2 === a.data.full_screen.show_rule && c < p) {
              var _ = parseInt((new Date(new Date().toLocaleDateString()).getTime() + 864e5 - 1) / 1e3);
              wx.setStorageSync("fullAdvertisement_expiration", _), a.setData({
                fullShow: !0
              }), setTimeout(function () {
                a.countDown(a.data.full_screen.show_time);
              }, 2e3);
            }
          } else {
            e.setData({
              readyshow: !0
            });
            var f, m = r.category,
              h = m,
              u = Math.ceil(m.length / 10);
            wx.setStorageSync("pageinfo", {
              title: e.data.mailInfo.name,
              desc: e.data.mailInfo.name
            }), wx.setNavigationBarTitle({
              title: e.data.mailInfo.name || ""
            }), f = m.length <= 5 ? "in1" : "in2";
            for (var w = [], v = 0; v < u; v++) {
              for (var D = [], S = 0; S < 10; S++) {
                null != m[S] && D.push(m[S]);
              }
              m = h = h.slice(10), w.push(D);
            }
            e.setData({
              footshow: !0,
              bottom_info: {},
              bannerData: r.ads,
              goodsData: r.goods,
              memuData: w,
              menuHeightClass: f
            });
          }
          e.setData({
            showPage: !0
          }), wx.hideLoading();
          try {
            var y = wx.getStorageSync("storage_newAward");
            if (y && y.prize) {
              var x = y,
                b = {},
                T = x.activity;
              b.type = x.activity.background_type, b.title = x.activity.title, b.awardlist = x.prize,
                0 == y.prize.length ? e.setData({
                  showNewcomerAward: !1
                }) : (e.setData({
                  new_member_prize: b,
                  activityDatas: T
                }), setTimeout(function () {
                  e.setData({
                    showNewcomerAward: !0
                  });
                }, 200));
            } else {
              var k = wx.getStorageSync("popAdvertisement");
              a.data.advertising && a.data.advertising.id && !k && 1 === a.data.advertising.show_rule && (wx.setStorageSync("popAdvertisement", !0),
                a.setData({
                  popShow: !0
                }));
              var A = wx.getStorageSync("popAdvertisement_expiration"),
                I = parseInt(Date.parse(new Date()) / 1e3);
              if (a.data.advertising && a.data.advertising.id && 2 === a.data.advertising.show_rule && A < I) {
                var M = parseInt((new Date(new Date().toLocaleDateString()).getTime() + 864e5 - 1) / 1e3);
                wx.setStorageSync("popAdvertisement_expiration", M), a.setData({
                  popShow: !0
                });
              }
            }
          } catch (a) {
            console.log("新人奖报错：：：", a);
          }
        },
        fail: function (a) {
          wx.stopPullDownRefresh({
            complete: function (a) {
              console.log("关闭下拉刷新", a, new Date());
            }
          });
        }
      });
    }
  },
  address_codeMethod: function () {
    var a = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : wx.getStorageSync("yz_basic_info");
    if (o.data.address_code) try {
      var e = a;
      if (e.plugin_setting.address_code && e.plugin_setting.address_code.enable) {
        var t = o.getNetAddresss("plugin.address-code.frontend.index.set-address");
        o._postNetWork({
          url: t,
          data: {
            address_id: o.data.address_code
          },
          success: function (a) {
            var e = a.data;
            1 == e.result ? (console.log(e.data), o.data.address_code = "") : (0 == e.data.status && wx.reLaunch({
              url: "/packageA/member/editmobile/editmobile?fromApp=1&is_code=1"
            }), console.log(e.data.status, "1146"));
          }
        });
      }
    } catch (a) {
      console.log(a);
    }
  },
  gotoBrand: function (a) {
    var e = a.currentTarget.dataset.item;
    wx.navigateTo({
      url: "/packageB/member/category/brandgoods/brandgoods?id=" + e.id
    });
  },
  gotoBrandV2: function () {
    wx.navigateTo({
      url: "/packageB/member/category/brand_v2/brand_v2"
    });
  },
  gotoTimeGood: function (a) {
    var e = a.currentTarget.dataset.item;
    wx.navigateTo({
      url: "/packageA/detail_v2/detail_v2?id=" + e.id
    });
  },
  gotoLimitedTimeGoods: function () {
    wx.navigateTo({
      url: "/packageG/limitedTimeGoods/limitedTimeGoods"
    });
  },
  getMoreDecorate: function () {
    var a = this;
    if (a.setData({
        decorate_isLoadMore: !1
      }), a.data.current_page < a.data.total_page) {
      a.setData({
        current_page: a.data.current_page + 1
      });
      var e = o.getNetAddresss("plugin.decorate.frotend.decorate-api.get-page");
      o._postNetWork({
        url: e,
        data: {
          decorate_page: this.data.current_page,
          decorate_id: this.data.page_id
        },
        success: function (e) {
          var t = e.data;
          1 == t.result ? a.setData({
            decorate_isLoadMore: !0,
            components: a.data.components.concat(t.data.datas)
          }) : (a.setData({
            decorate_isLoadMore: !1,
            current_page: a.data.current_page - 1
          }), console.log(t.msg));
        }
      });
    }
  },
  getAdvertise: function () {
    var a = this,
      e = o.getNetAddresss("member.member.getAdvertisement");
    o._getNetWork({
      url: e,
      success: function (e) {
        var t = e.data;
        1 == t.result ? t.data.advertisement && (a.setData({
          advertisement: t.data.advertisement
        }), a.data.advertisement.switch && (1 === a.data.advertisement.rule ? a.data.everyTime || (a.setData({
          fullShow: !0
        }), a.countDown(a.data.advertisement.time)) : (a.setData({
          fullShow: !0,
          everyTime: !0
        }), a.countDown(a.data.advertisement.time))), a.data.advertisement.Midswitch && (1 === a.data.advertisement.Midrule ? a.data.everyTime || a.setData({
          popShow: !0
        }) : (console.log("弹窗每次登录"), a.setData({
          popShow: !0,
          everyTime: !0
        })))) : (console.log(t.msg, "该用户不是首次登录"), a.setData({
          advertisement: t.data
        }), a.data.advertisement.switch && (1 === a.data.advertisement.rule ? (a.setData({
          fullShow: !1
        }), a.countDown(a.data.advertisement.time)) : (a.setData({
          fullShow: !0
        }), a.countDown(a.data.advertisement.time))), a.data.advertisement.Midswitch && (1 === a.data.advertisement.Midrule ? a.setData({
          popShow: !1
        }) : a.setData({
          popShow: !0
        })));
      },
      fail: function (a) {
        console.log(a);
      }
    });
  },
  turnFullTo: function () {
    var a = this.data.full_screen.minapp_link;
    try {
      wx.navigateTo({
        url: a
      });
    } catch (a) {
      wx.showToast({
        title: "链接设置错误",
        icon: "none",
        duration: 2e3
      });
    }
  },
  turnTo: function () {
    if (2 == this.data.advertising.is_minapp)
      if (this.data.advertising.minapp_sid)
        if (this.data.advertising.minapp_link2) try {
          wx.navigateToMiniProgram({
            appId: this.data.advertising.minapp_sid,
            path: this.data.advertising.minapp_link2,
            extraData: {},
            envVersion: "release",
            success: function (a) {},
            fail: function (a) {
              wx.showToast({
                title: "小程序跳转失败",
                icon: "none",
                duration: 2e3
              });
            }
          });
        } catch (a) {
          wx.showToast({
            title: "小程序跳转失败",
            icon: "none",
            duration: 2e3
          });
        } else wx.showToast({
          title: "请设置跳转小程序后的跳转链接",
          icon: "none",
          duration: 2e3
        });
        else wx.showToast({
          title: "请设置小程序所需跳转appId",
          icon: "none",
          duration: 2e3
        });
    else {
      var a = this.data.advertising.minapp_link;
      try {
        wx.navigateTo({
          url: a
        });
      } catch (a) {
        wx.showToast({
          title: "链接设置错误",
          icon: "none",
          duration: 2e3
        });
      }
    }
  },
  closePop: function () {
    this.setData({
      popShow: !1
    });
  },
  closeFull: function () {
    this.setData({
      fullShow: !1
    });
  },
  countDown: function (a) {
    var e = this,
      t = a;
    this.setData({
      "full_screen.show_time": t,
      "advertisement.time": t
    }), t--;
    var o = setTimeout(function () {
      t <= 0 ? (e.setData({
        fullShow: !1
      }), clearInterval(o)) : e.countDown(t);
    }, 1e3);
  },
  tel: function (a) {
    var e = a.currentTarget.dataset.telnum;
    wx.makePhoneCall({
      phoneNumber: e
    });
  },
  goToDetail: function (a) {
    var e = "/packageA/detail_v2/detail_v2?id=" + a.currentTarget.id;
    wx.navigateTo({
      url: e
    }), console.log(e);
  },
  goGoodsList: function (a) {
    var e = a.currentTarget.dataset.id;
    wx.navigateTo({
      url: "/packageB/member/category/catelist/catelist?id=" + e
    });
  },
  clickADTo: function () {
    if (this.data.bannerData[0].small_link) {
      console.log("设置小程序跳转", this.data.bannerData[0].small_link);
      try {
        wx.navigateTo({
          url: this.data.bannerData[0].small_link
        });
      } catch (a) {
        console.log(a);
      }
    }
  },
  clickADPlaceTo: function (a) {
    var e = a.currentTarget.dataset.link;
    if (console.log("设置小程序跳转", e), e) try {
      wx.navigateTo({
        url: e
      });
    } catch (a) {
      console.log(a);
    }
  },
  getMoreData: function () {
    var a = this;
    if (a.setData({
        isLoadMore: !1
      }), !(this.data.page >= this.data.last_page)) {
      a.setData({
        page: this.data.page + 1
      });
      var e = o.getNetAddresss("home-page.get-first-goods-page");
      o._getNetWork({
        url: e,
        data: {
          page: a.data.page
        },
        success: function (e) {
          var t = e.data;
          if (1 == t.result) {
            a.data.page >= a.data.last_page ? a.setData({
              isLoadMore: !1
            }) : a.setData({
              isLoadMore: !0
            });
            var o = t.data.data;
            a.setData({
              "defaultdata.goods.data": a.data.defaultdata.goods.data.concat(o)
            });
          } else a.setData({
            page: a.data.page - 1,
            isLoadMore: !1
          });
        },
        fail: function (a) {
          console.log(a);
        }
      });
    }
  },
  gophone: function (a) {
    var e = a.currentTarget.dataset.num;
    wx.makePhoneCall({
      phoneNumber: e
    });
  }
});